import {getShopByHot} from '@/api'
const state = {
    hotArtworks:false,
    filterOptions:{
        pageSize: "2",
        pageIndex: "1",
        user_address: "",
        classify:"所有",
        form_of_sale:"所有",
        minprice:"0",
        maxprice:"100000000000000000000",
        type:'shop'
    },
    hotCollections:{}
}

const mutations = {
    HOTARTWORKS(context,data){
        context.hotArtworks = data
    },
    FILTEROPTIONS(context, data){
        context.filterOptions = data
    },
    HOTCOLLECTIONS(context, data){
        context.hotCollections = data
    }
}

const actions = {
    async hotArtworks({commit},data){
        commit("FILTEROPTIONS", data)
        let result = await getShopByHot(data)
        commit("HOTARTWORKS", result)
    },
    async hotCollections({commit} ,params){
        let {pageIndex, pageSize} = params
        let result = await getShopByHot({
            pageIndex, pageSize,
            type:"array",
            minprice:"0",
            maxprice:"0"
        })
        commit("HOTCOLLECTIONS", result)
    }
}

const getters = {}

export default {
    state,
    mutations,
    actions,
    getters
}